package com.liam.chinesevietnamesecorpus.dto;

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

/**
 * 用户数据传输对象
 * 
 * @author Liam
 */
@Data
public class UserDTO {

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空")
    @Size(min = 3, max = 20, message = "用户名长度必须在3-20字符之间")
    @Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "用户名只能包含字母、数字和下划线")
    private String username;

    /**
     * 邮箱
     */
    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    private String email;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 20, message = "密码长度必须在6-20字符之间")
    private String password;

    /**
     * 角色
     */
    @Pattern(regexp = "^(admin|editor|user)$", message = "角色只能是admin、editor或user")
    private String role = "user";

    /**
     * 状态
     */
    @Pattern(regexp = "^(active|inactive|locked)$", message = "状态只能是active、inactive或locked")
    private String status = "active";

    /**
     * 邮箱验证码
     */
    @NotBlank(message = "邮箱验证码不能为空")
    @Size(min = 6, max = 6, message = "邮箱验证码必须是6位数字")
    @Pattern(regexp = "^\\d{6}$", message = "邮箱验证码必须是6位数字")
    private String verificationCode;
}
